package com.course.controller;

import com.course.component.http.Crp;
import com.course.dto.reqs.RequestDictionaries;
import com.course.dto.reqs.RequestDictionariesInfo;
import com.course.dto.reqs.RequestRole;
import com.course.masterservice.DictionariesInfoMasterService;
import com.course.masterservice.DictionariesMasterService;
import com.course.masterservice.RoleMasterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Copyright: Copyright (c)  林中小鸟  All rights reserved.
 * @author: moon
 * @date: 2022/9/20 11:12
 * @Description: **********************
 */
@RestController
@RequestMapping(value = "/x/dic")
public class DictionariesController {
    @Autowired
    private DictionariesMasterService dictionariesMasterService;

    @Autowired
    private DictionariesInfoMasterService dictionariesInfoMasterService;

    @GetMapping(value = "list")
    public Crp diclist(RequestDictionaries requestDictionaries) {
        return Crp.success(dictionariesMasterService.list(requestDictionaries));
    }

    @GetMapping(value = "tree")
    public Crp dictree(RequestDictionaries requestDictionaries) {
        return Crp.success(dictionariesMasterService.tree(requestDictionaries));
    }

    @GetMapping(value = "get")
    public Crp dicget(RequestDictionaries requestDictionaries) {
        return Crp.success(dictionariesMasterService.get(requestDictionaries));
    }

    @DeleteMapping(value = "del")
    public Crp dicdel(@RequestBody RequestDictionaries requestDictionaries) {
        return Crp.success(dictionariesMasterService.del(requestDictionaries));
    }

    @PostMapping(value = "edit")
    public Crp dicedit(@RequestBody RequestDictionaries requestDictionaries) {
        return Crp.success(dictionariesMasterService.update(requestDictionaries));
    }

    /**************************************详情****************************************/
    @GetMapping(value = "infoList")
    public Crp dicInfolist(RequestDictionariesInfo requestDictionariesInfo) {
        return Crp.success(dictionariesInfoMasterService.list(requestDictionariesInfo));
    }

    @DeleteMapping(value = "infoDel")
    public Crp dicInfodel(@RequestBody RequestDictionariesInfo requestDictionariesInfo) {
        return Crp.success(dictionariesInfoMasterService.del(requestDictionariesInfo));
    }

    @PostMapping(value = "infoEdit")
    public Crp dicInfoedit(@RequestBody RequestDictionariesInfo requestDictionariesInfo) {
        return Crp.success(dictionariesInfoMasterService.update(requestDictionariesInfo));
    }
}
